<extend name="Public:base" />
<block name="Controller">Nav</block>
<block name="Main">
    <div class="col-md-10 main padding">
    <div class="cl">
        <div class="fl"><h2>新增导航</h2></div>
        <div class="fr">
            <a class="btn btn-warning" href="{:U('Admin/Nav/design')}">导航设计</a>
            <a class="btn btn-primary" href="{:U('Admin/Nav/add')}">新增导航</a>
        </div>
    </div>
    <div class="cf"></div>
    <hr />
        <form name="form" method="post" action="{:U('Admin/Nav/insert')}" class="form form-horizontal form-validate">
            <div class="form-group ">
                <label for="ipt-title" class="col-sm-2 form-label">标题：</label>
                <div class="col-sm-10">
                    <input class="form-field" type="text" name="name" data-rule-required="true" >
                </div>
            </div>
            <div class="form-group form-icon">
                <label for="ipt-logo" class="col-sm-2 form-label">导航图标：</label>
                <div class="col-sm-10">
                    <a data-fancybox-type="iframe" class="button small fancybox" href="{:U('Admin/FileManager/index')}#icon"><i class="icon-file-image-o"></i></a>
                    
                    <input class="form-field webupload" class="webupload" type="text" name="icon" >
                </div>
            </div>
        
            <div class="form-group">
                <label for="ipt-name" class="col-sm-2 form-label">排序：</label>
                <div class="col-sm-10">
                    <input class="form-field" type="text"  name="idx" >
                </div>
            </div>
            
            <div class="form-group">
                <label for="ipt-contact" class="col-sm-2 form-label">外网连接：</label>
                <div class="col-sm-10">
                    <select name="module">
                        <option value="info" >否</option>
                        <option value="url">是</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label for="ipt-tel" class="col-sm-2 form-label">外网网址：</label>
                <div class="col-sm-10">
                    <input type="text" name="url" >
                </div>
            </div>
           

            <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary">提交保存</button>
            </div>
          </div>
        </form>
    </div>
<load href="Public/fancyBox/jquery.fancybox.css" />
<script type="text/javascript">
require("nprogress/nprogress,jquery,app,jquery.validate,fancyBox/jquery.fancybox", function(nprogress,$,app,validate) {
    $(".fancybox").fancybox({
        maxWidth    : 800,
        maxHeight   : 900,
        fitToView   : false,
        width       : '70%',
        height      : '70%',
        autoSize    : false,
        closeClick  : false,
        openEffect  : 'none',
        closeEffect : 'none'
    });
            $('[name=url]').parent().parent().hide();
$('[name=module]').on('change',function(){
        var v = $(this).val();
        if (v == 'url') {
            $('[name=url]').parent().parent().show();
        }else{
            $('[name=url]').parent().parent().hide();
            $('[name=url]').val('');
        }
    })    

    $('.form-validate').each(function() {
        var $obj = $(this);
        $obj.validate(app.validateOpt());
    });

    var Nav = avalon.define('Nav', function(vm) {
        //
    })
    avalon.scan()
}) 

</script>  
</block>